package com.wnxy.admin.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Map;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResponseResult<T> {
    private Integer code;
    private String msg;
    private T datas;

    public static ResponseResult ok(){
        return new ResponseResult(200,"ok",null);
    }

    public static <T> ResponseResult ok(T datas){
        return new ResponseResult(200,"ok",datas);
    }

    public static ResponseResult fail(IErrorCode errorCode){
        return new ResponseResult(errorCode.getCode(),errorCode.getMsg(),null);
    }
}
